package View.Menu;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Utils.ConstantsImplement;
import View.General.ComponentPanel;

public class OptionMenu extends ComponentPanel implements ConstantsImplement{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private BufferedImage imageBackground ;
	private Toolkit tk;
	private Dimension d;
	private JCheckBox selectFullScreen;
	private JLabel selectFullScreenLabel;

	private JButton back_;
	
	public OptionMenu() {
		setLayout(null);
		tk = Toolkit.getDefaultToolkit();
		d = tk.getScreenSize();
		// TODO Auto-generated constructor stub
		try {
			imageBackground = ImageIO.read(new File("src/Image/Credits.png"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		selectFullScreen = new JCheckBox();
		selectFullScreenLabel = new JLabel();
		back_ = new JButton();
		
		// setPoint
		selectFullScreen.setLocation(MENU_BUTTON_LOCATION_RATE_X, MENU_BUTTON_FIRST_LOCATION_Y);
		selectFullScreenLabel.setLocation(MENU_BUTTON_LOCATION_RATE_X, MENU_BUTTON_FIRST_LOCATION_Y);
		back_.setLocation(MENU_BUTTON_LOCATION_RATE_X + 100, selectFullScreen.getY() + MENU_BUTTON_DISTANCE_Y);
		//setSize
		selectFullScreen.setSize(MENU_CHECKBOX_RATE_W, MENU_CHECKBOX_RATE_H);
		selectFullScreenLabel.setSize(MENU_BUTTON_RATE_W, MENU_BUTTON_RATE_H);
		back_.setSize(MENU_BUTTON_RATE_W, MENU_BUTTON_RATE_H);
		
		//setText
		selectFullScreenLabel.setText("FullScreen");
		back_.setText("Back");
		
		//Adding
		//this.add(selectFullScreen);
		//this.add(selectFullScreenLabel);
		this.add(back_);
		
		
	}
	
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		g.drawImage(imageBackground, 0, 0, getWidth(), getHeight(), null);
	}
	
	public void addSelectFullScreenActionListener(ActionListener select){
		selectFullScreen.addActionListener(select);
	}

	public boolean isSelectFullScreen() {
		return selectFullScreen.isSelected();
	}

	public void setSelectFullScreen(JCheckBox selectFullScreen) {
		this.selectFullScreen = selectFullScreen;
	}
	
	public void addBackActionListener(ActionListener back){
		back_.addActionListener(back);
	}
	
}
